home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 27.zip
/
BS1 part 27
/
PhonepakV2_d1.adf
/
rexx
/
AutoDelete.ppak
next >
Wrap
Text File
|
1993-05-05
|
5KB
|
133 lines
/****************************************************************************/
/* This is a PhonePak ARexx script that executes its argument as an */
/* Operator string, and if the execution is successful, automatically */
/* deletes any fax files found in the Operator string. Typically, this */
/* script would be specified under the Group= Tool Type in PPakFax's icon. */
/****************************************************************************/
/***************/
/* Constants */
/***************/
interval = 10 /* Minutes before next attempt */
maxlines = 5 /* Maximum number of phone lines */
/******************/
/* MAIN ROUTINE */
/****************************************************************************/
options failat 101
options results
addlib("libs:rexxsupport.library",0,-30,0)
arg PhoneNumber /* Get args handed in by LineMan */
Upper PhoneNumber
Mailbox = GetDirName(pragma('d')) /* Get mailbox name (current dir) */
Upper Mailbox /* Make sure its upper case */
/***********************************/
/* Try to find an available line */
/***********************************/
x = 1
do forever
PortName = 'LINEMAN.' || x /* Assemble the port name */
if show('P', PortName) then do /* See if the port is present */
address value PortName /* Modify host address */
call ExOp() /* Only returns if call should */
end /* be tried on another line. */
if x = maxlines then
exit interval "'Line not avail'" /* Outer quotes get stripped */
else
x = x + 1 /* Increment line # and continue */
end
/****************************************************************************/
/*********************************/
/* SUBROUTINE */
/* Execute Operator string */
/*********************************/
ExOp:
CHANGEDIR pragma('d') /* Set LineMan's current dir to mailbox dir */
OPERATOR PhoneNumber /* Dial the phone number */
DialResult = rc
if DialResult ~= 0 then /* Hang up on error */
Operator '<H>'
select
when DialResult = -3 then /* Make sure phone # is 'raw' */
exit "-1 'Procedure error'"
when DialResult = -2 then /* Probably a missing message */
exit "-1 'I/O error'"
when DialResult = -1 then
exit "-1 'Syntax error'"
when DialResult = 0 then
nop
when DialResult = 1 then
exit interval "'Resource error'"
when DialResult = 2 then
exit interval "'Local pickup'"
when DialResult = 4 then
return
when DialResult = 5 then
exit interval "'No dialtone'"
when DialResult = 6 then
exit interval "'No answer'"
when DialResult = 7 then
exit "-1 'Fax error'"
when DialResult = 8 then
exit interval "'Busy signal'"
when DialResult = 98 | DialResult = 99 then
return
otherwise
exit "-1 'Fatal error'"
end
/**********************/
/* Delete fax files */
/**********************/
Index = 1
do forever
Index = pos('<X', PhoneNumber, Index)
if Index > 0 then do /* Find Xmit command */
Index = pos(' ', PhoneNumber, Index) /* Find arg */
Work = substr(PhoneNumber, Index + 1) /* Copy arg */
End = pos('>', Work) /* Find end of arg */
Work = delstr(Work, End) /* Strip chars after arg */
Info = statef(Work) /* Get info about file */
if word(Info, 8) = 'New' then /* If file is new */
ADJNEWCOUNT Mailbox '-1' /* Decrement newcount */
delete(Work) /* Delete file */
end
else
break
end
exit /* Success! */
/***********************************/
/* SUBROUTINE */
/* Get name of current directory */
/***********************************/
GetDirName:
path = arg(1)
n = lastpos("/",path)
if n=0 then
n = lastpos(":",path)
return substr(path, n+1)